package com.qfedu.factory;

/**
 * @Classname PayFactory
 * @Description TODO
 * @Date 2025-10-10 15:01
 * @Created by 老任与码
 */
// 工厂类，创建对象的静态方法
public class PayFactory {

    public static PayInterface createInstance(Integer type) {
        switch (type) {
            case 1:
                return new WxPay();
            case 2:
                return new AliPay();
        }
        return null;
    }

    public static PayInterface createInstance(Class cls) throws Exception {
        return (PayInterface) cls.newInstance();
    }
}
